import { getSystemIcon } from '@/api/utils/image';
import { openBrowser, openImage, openNotepad, openVideo } from '@/global/window/widget';
import { openWindow } from '@/global/window/window';
import { getHost } from '@/store/system/utils';

import Help from '@/views/widget/help/Help.vue';
import Test from '@/views/widget/test/Test.vue';

interface Plugin {
  title: string;
  icon: string;
  action: any;
  id: string;
}

export const showStarter = ref(false);

export const plugins: Plugin[] = [
  {
    title: '记事本',
    id: 'notepad',
    icon: getSystemIcon(`system/notepad.png`),
    action() {
      openNotepad({
        data: '',
      });

      showStarter.value = false;
    },
  },
  {
    title: '帮助',
    id: 'help',
    icon: getSystemIcon(`system/help.png`),
    action() {
      openWindow({
        component: markRaw(Help),
        title: '帮助中心',
      });

      showStarter.value = false;
    },
  },
  {
    title: '浏览器',
    id: 'browser',
    icon: getSystemIcon(`system/edge.png`),
    action() {
      openBrowser({
        src: '',
        type: 'link',
      });
      showStarter.value = false;
    },
  },
  {
    title: '图形',
    id: 'image',
    icon: getSystemIcon(`system/image.png`),
    action() {
      openImage({
        src: '',
        mode: 'view',
      });
      showStarter.value = false;
    },
  },
  {
    title: '视频',
    id: 'video',
    icon: getSystemIcon(`system/video.png`),
    action() {
      openVideo('');
      showStarter.value = false;
    },
  },
  {
    title: '测试',
    id: 'test',
    icon: getSystemIcon(`system/test.png`),
    action() {
      openWindow({
        component: markRaw(Test),
        title: '测试',
      });
      showStarter.value = false;
    },
  },
];
